When you get hold of an element in an array you use a subscript:

/* set score of the fourth */
/* batsman to 0            */
scores [3] = 0 ;

The [3] takes you to the element which is 3 beyond the start of the array. This is why we use 0 as the start of an array, this takes us to the element which is 0 beyond the start of the array, i.e. at the very beginning. On the right you can see the position in the array of this element.

C actually implements an array as a block of memory and a pointer to the base of the memory. When you say scores [i] you are actually de-referencing the pointer scores. The variable scores is actually a pointer which points at the base of the scores array. When you put a subscript on it, this tells the compiler that you want to follow the pointer to the base of the scores area in memory and then move down memory to the actual location which is needed.

The fact that C links pointers and arrays in this way is very useful, in that we can refer to any block of memory as an array, there is nothing "special" about the array type. Furthermore, if we create a variable which points at memory (a pointer type) we can use any item of memory which the pointer is set to point at as an array.

 


scores[3], refers to the third element down from pointer scores.